import axios from 'axios';
import queryString from 'querystring';
axios.interceptors.request.use(function(config){
  config.data = queryString.stringify(config.data);
  config.headers['Content-Type'] = 'application/x-www-form-urlencoded';
  return config;
});
let instance = axios.create({
  baseURL: 'https://api.weixin.qq.com',
  timeout: 5000,
  headers: {'Accept':'application/json, text/plain, */*'}
});
axios.defaults.baseURL = 'https://portal.rulaiyun.net/api/public/index.php';
export default {
  getToken(){
    return instance.get('/cgi-bin/token?grant_type=client_credential&appid=wx47ca0d7f12c5d795&secret=0b9965a11ce57bcb3f32ee8cfe07ef09')
  },
  login(params){
    return axios.get('/demo/wechat/wechatplaceList',{
      params: params
    });
  },
  getPlaceInfo(params){
    return axios.get('/demo/wechat/wechatPlaceInfo',{
      params: params
    });
  },
  pay(data){
    return axios.post('/demo/pays/payment',data);
  }
}
